package com.yly.input.demo.service;

import com.yly.input.demo.bo.ElderBO;
import com.yly.input.demo.business.ElderBusiness;
import com.yly.input.demo.converter.ServiceConverter;
import com.yly.input.demo.dto.ElderDTO;
import com.yly.input.demo.repository.entity.Elder;
import com.yly.input.demo.vo.ElderVO;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Log4j2
@Service
public class ElderService {

    private final ElderBusiness elderBusiness;

    private final ServiceConverter serviceConverter;

    @Autowired
    public ElderService(ElderBusiness elderBusiness, ServiceConverter serviceConverter) {
        this.elderBusiness = elderBusiness;
        this.serviceConverter = serviceConverter;
    }

    public List<ElderVO> getElders() {
        return serviceConverter.toElderVO(elderBusiness.getElders());
    }
}
